<template>
	<view class="main-content">
		<MHeader>{{state.pageName}}</MHeader>
		<scroll-view scroll-y="true" style="height:calc(100% - 80rpx)">
			<view>
				<item name="单据编号">
					<view>{{state.info.Data.BillNo}}</view>
				</item>
				<item name="单据状态">
					<view class="input">{{state.info.Data.DocumentStatus?state.status[state.info.Data.DocumentStatus]:''}}</view>
				</item>
				<item name="组织">
					<view>{{state.info.Data.F_QUQY_ORGID?.Name[0].Value}}</view>
				</item>
				<item name="养殖批次名称">
					<view>{{state.info.Data.F_QUQY_BREEDBATCH?.Name[0].Value}}</view>
				</item>
				<item name="养殖批次编码">
					<view>{{state.info.Data.F_QUQY_BREEDBATCH?.Number}}</view>
				</item>
				<item name="目前在栏数量">
					<view type="number" style="padding-right: 35rpx;">{{state.info.Data.F_QUQY_COLUMNQTY}}</view>
					<text class="symbol">只</text>
				</item>
				<item name="损失数量">
					<view style="padding-right: 35rpx;">{{state.info.Data.F_QUQY_QTY}}</view>
					<text class="symbol">只</text>
				</item>
				<item name="申请日期">
					<view>{{state.info.Data.F_QUQY_DATE?moment(state.info.Data.F_QUQY_DATE).format('YYYY-MM-DD'):''}}</view>
				</item>
				<item name="备注">
					<view>{{state.info.Data.F_QUQY_REMARK}}</view>
				</item>
			</view>
		</scroll-view>
	</view>
	<Loading v-if="state.loading"></Loading>
</template>

<script setup>
	import moment from 'moment'
	import { reactive, getCurrentInstance, ref, watch, nextTick } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { checkForm, msg } from '/utils/utils.js'
	import kdApis from '/api/modularApi/kdApi.js'
	const { proxy } = getCurrentInstance()
	const state = reactive({
		info: {
			FormId: 'QUQY_LossInfoMiao',
			Data: {}
		},
		pageName: "上苗计划详情",
		status: {
			Z: '暂 存',
			A: '保 存',
			B: '审核中',
			C: '已审核',
			D: '重新审核'
		},
		loading: true
	})

	const getDetails = (Id) => {
		kdApis.formView({
			formId: 'QUQY_LossInfoMiao',
			data: { Id }
		}).then(res => {
			if (res) {
				state.info.Data = res
				state.loading = false
			}
		})
	}

	onLoad(async (query) => {
		if (query.Id) {
			state.pageName = "苗损详情"
			getDetails(query.Id)
		}
	})
</script>
<style lang="scss" scoped>

</style>